package com.back.Dao;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {
    public static final String CODE_SUCCESS = "200";
    public static final String CODE_SYS_ERROR = "500";
    private String code;
    private String msg;
    private Object data;
    public static R success(Object data) {
        return new R(CODE_SUCCESS,"success!",data);
    }
    public static R success() {
        return new R(CODE_SUCCESS,"success!",null);
    }
    public static R error(String msg) {
        return new R(CODE_SYS_ERROR ,msg,null);
    }
    public static R error(String msg,Object data) {
        return new R(CODE_SYS_ERROR ,msg,data);
    }
    public static R error(String code, String msg) {
        return new R(code, msg, null);
    }
}
